import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity('file')
export class File {
  @PrimaryGeneratedColumn({
    name: 'file_id',
    type: 'int',
    comment: '文件id',
  })
  fileId: number;

  @Column({
    name: 'unique',
    type: 'varchar',
    length: 127,
    default: '',
    comment: '标识（唯一）',
  })
  unique: string;

  @Column({
    name: 'group_id',
    type: 'int',
    default: 0,
    comment: '分组id',
  })
  groupId: number;

  @Column({
    name: 'storage',
    type: 'varchar',
    length: 11,
    default: 'local',
    comment: '存储方式，local本地(服务器)，qiniu七牛云Kodo，aliyun阿里云OSS，tencent腾讯云COS，upyun又拍云USS，huawei华为云OBS，aws AWS S3',
  })
  storage: string;

  @Column({
    name: 'domain',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '访问域名',
  })
  domain: string;

  @Column({
    name: 'file_type',
    type: 'varchar',
    length: 11,
    default: 'image',
    comment: '文件类型，image图片，video视频，audio音频，word文档，other其它',
  })
  fileType: string;

  @Column({
    name: 'file_md5',
    type: 'varchar',
    length: 127,
    default: '',
    comment: '文件MD5',
  })
  fileMd5: string;

  @Column({
    name: 'file_hash',
    type: 'varchar',
    length: 127,
    default: '',
    comment: '文件散列（sha1）',
  })
  fileHash: string;

  @Column({
    name: 'file_name',
    type: 'varchar',
    length: 511,
    default: '',
    comment: '文件名称',
  })
  fileName: string;

  @Column({
    name: 'file_path',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '文件路径',
  })
  filePath: string;

  @Column({
    name: 'file_ext',
    type: 'varchar',
    length: 11,
    default: '',
    comment: '文件后缀',
  })
  fileExt: string;

  @Column({
    name: 'file_size',
    type: 'int',
    default: 0,
    comment: '文件大小，字节（b）',
  })
  fileSize: number;

  @Column({
    name: 'remark',
    type: 'varchar',
    length: 255,
    default: '',
    comment: '备注',
  })
  remark: string;

  @Column({
    name: 'sort',
    type: 'int',
    default: 250,
    comment: '排序',
  })
  sort: number;

  @Column({
    name: 'is_front',
    type: 'tinyint',
    default: 0,
    comment: '是否前台上传，1是0否',
  })
  isFront: number;

  @Column({
    name: 'is_disable',
    type: 'tinyint',
    default: 0,
    comment: '是否禁用，1是0否',
  })
  isDisable: number;

  @Column({
    name: 'is_delete',
    type: 'tinyint',
    default: 0,
    comment: '是否删除，1是0否',
  })
  isDelete: number;

  @Column({
    name: 'create_uid',
    type: 'int',
    default: 0,
    comment: '添加用户id',
  })
  createUid: number;

  @Column({
    name: 'update_uid',
    type: 'int',
    default: 0,
    comment: '修改用户id',
  })
  updateUid: number;

  @Column({
    name: 'delete_uid',
    type: 'int',
    default: 0,
    comment: '删除用户id',
  })
  deleteUid: number;

  @Column({
    name: 'create_time',
    type: 'datetime',
    nullable: true,
    comment: '添加时间',
  })
  createTime: Date;

  @Column({
    name: 'update_time',
    type: 'datetime',
    nullable: true,
    comment: '修改时间',
  })
  updateTime: Date;

  @Column({
    name: 'delete_time',
    type: 'datetime',
    nullable: true,
    comment: '删除时间',
  })
  deleteTime: Date;
}